package com.dream21th.oauth.remote;

import com.dream21th.oauth.remote.fallback.AdminFeignFallback;
import com.dream21th.common.ComResp;
import com.dream21th.common.dto.UserDTO;
import com.dream21th.common.dto.UserTokenDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(value = "risk-admin-web",fallback = AdminFeignFallback.class)
public interface AdminFeign {

    /**
     * 获取个人信息
     *
     * @param username {@code String} 用户名
     * @return {@code String} JSON
     */
    @GetMapping(value = "/sys/user/{username}")
    ComResp<UserDTO> info(@PathVariable("username") String username);


    /**
     * 查询用户登陆成功后的token
     * @param username
     * @return
     */
    @GetMapping("/sys/user/token/{username}")
    ComResp<UserTokenDTO> queryUserLoginToken(@PathVariable("username") String username);

    /**
     * 保存用户登陆成功后的token
     * @param userTokenDTO
     * @return
     */
    @PostMapping("/sys/user/saveUserLoginToken")
    ComResp saveUserLoginToken(@RequestBody UserTokenDTO userTokenDTO);
}
